package nuc.sw.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import nuc.sw.dao.UserDAO;
import nuc.sw.dao.impl.UserDAOImpl;
import nuc.sw.entity.User;
@Component("userService")
public class UserService {

	private UserDAO userDAO;

	public UserDAO getUserDAO() {
		return userDAO;
	}

	@Resource(name="userDAOImpl")
	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

	public void addUser(User user) throws Exception {
		userDAO.save(user);
	}
	
	public List<User> findAllUser() throws Exception{
		return userDAO.findAll();
	}
	
	public void deleteUser(User user) throws Exception{
		userDAO.delete(user);
	}
	
	public void updateUser(User user) throws Exception{
		userDAO.update(user);
	}
}
